#include <stdio.h>
#include <string.h>

//诗选字符串中每个单词逆序 hello word  -----> olleh drow
void str_revese(char* left, char* right);
int main()
{
    char arr[101] = {0};
    gets(arr);
    int sz = strlen(arr);

    str_revese(arr, arr+sz-1);
    printf("%s\n", arr);
    char* start = arr;
    char* end = arr;
    while(*start)
    {
        while (*end !=' ' && *end !='\0'3
            end++;
        str_revese(start, end - 1);
        end++;
        start = end;
    }
//
//
//
    printf("%s", arr);
    return 0;
}

void str_revese(char* left, char* right)
{
    while(left < right)
    {
        char temp = *left;
        *left = *right;
        *right = temp;
        left++;
        right--;
    }
}